N            equ    3


             org  $1000
start        move.b  #0,d1      ; initial counter d1
             move.b  data,d0    ; original data
             move.b  #N,d2
loop         cmp.b   d2,d0
             ble     x1
             add.b   #1,d1      ; increment counter
             sub.b   #2,d0      ; subtract data by 2
             bra     loop
x1           nop


              org  $10a0
data          ds.b  1

